
<%@ page import="org.xilin.Semester" %>

<g:setProvider library="jquery"/>

<div>
    <g:if test="${flash.message}">
        <div class="message" style="display:none">${flash.message}</div>
    </g:if>
    <g:hasErrors bean="${semesterInstance}">
        <div class="errors" style="display:block">
            <g:renderErrors bean="${semesterInstance}" as="list" />
        </div>
    </g:hasErrors>
    <g:formRemote name="saveSemester" url="${[action:'save']}" method="post" update="cluetip-inner" before="beforeSave()" onComplete="processResponse({cluetipWidth:'800px'})">
        <g:hiddenField name="view" value="create" />
        <div class="dialog">
            <table>
                <tbody>

                    <tr class="prop">
                        <td valign="top" class="name">
                            <label for="year"><g:message code="semester.year.label" default="Year" /></label>
                        </td>
                        <td valign="top" class="value">
                            <select class="year" name="year"></select>
                        </td>
                        <td style="width:20px"></td>
                        <td valign="top" class="name">
                            <label for="semester"><g:message code="semester.semester.label" default="Semester" /></label>
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: semesterInstance, field: 'semester', 'errors')}">
                            <g:select name="semester" from="${semesterInstance.constraints.semester.inList}" value="${semesterInstance?.semester}" valueMessagePrefix="semester.semester"  />
                        </td>
                    </tr>

                   <tr class="prop">
                        <td valign="top" class="name">
                            <label for="startDate"><g:message code="semester.startDate.label" default="Start Date" /></label>
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: semesterInstance, field: 'startDate', 'errors')}">
                            <g:textField class="date-pick" name="startDate" value="${fieldValue(bean: semesterInstance, field: 'startDate')}" />
                        </td>
                        <td style="width:20px"></td>
                        <td valign="top" class="name">
                            <label for="endDate"><g:message code="semester.endDate.label" default="End Date" /></label>
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: semesterInstance, field: 'endDate', 'errors')}">
                            <g:textField class="date-pick" name="endDate" value="${fieldValue(bean: semesterInstance, field: 'endDate')}" />
                        </td>
                    </tr>

                    <tr class="prop">
                        <td valign="top" class="name">
                            <label for="regStartDate"><g:message code="semester.regStartDate.label" default="Reg. Start Date" /></label>
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: semesterInstance, field: 'regStartDate', 'errors')}">
                            <g:textField class="date-pick" name="regStartDate" value="${fieldValue(bean: semesterInstance, field: 'regStartDate')}" />
                        </td>
                        <td style="width:20px"></td>
                        <td valign="top" class="name">
                            <label for="regEndDate"><g:message code="semester.regEndDate.label" default="Reg. End Date" /></label>
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: semesterInstance, field: 'regEndDate', 'errors')}">
                            <g:textField class="date-pick" name="regEndDate" value="${fieldValue(bean: semesterInstance, field: 'regEndDate')}" />
                        </td>
                    </tr>

                    <tr class="prop">
                        <td valign="top" class="name">
                            <label for="earlyRegDiscountEndDate"><g:message code="semester.earlyRegDiscountEndDate.label" default="Early Reg. Discount End Date" /></label>
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: semesterInstance, field: 'earlyRegDiscountEndDate', 'errors')}">
                            <g:textField class="date-pick" name="earlyRegDiscountEndDate" value="${fieldValue(bean: semesterInstance, field: 'earlyRegDiscountEndDate')}" />
                        </td>
                        <td style="width:20px"></td>
                        <td valign="top" class="name">
                            <label for="lastDayToChangeClass"><g:message code="semester.lastDayToChangeClass.label" default="Last Day To Change Class" /></label>
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: semesterInstance, field: 'lastDayToChangeClass', 'errors')}">
                            <g:textField class="date-pick" name="lastDayToChangeClass" value="${fieldValue(bean: semesterInstance, field: 'lastDayToChangeClass')}" />
                        </td>
                    </tr>

                    <tr class="prop">
                        <td valign="top" class="name">
                            <label for="lastDayToReturnBook"><g:message code="semester.lastDayToReturnBook.label" default="Last Day To Return Book" /></label>
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: semesterInstance, field: 'lastDayToReturnBook', 'errors')}">
                            <g:textField class="date-pick" name="lastDayToReturnBook" value="${fieldValue(bean: semesterInstance, field: 'lastDayToReturnBook')}" />
                        </td>
                        <td style="width:20px"></td>
                        <td valign="top" class="name">
                            <label for="regFee"><g:message code="semester.regFee.label" default="Registration Fee" /></label>
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: semesterInstance, field: 'regFee', 'errors')}">
                            <g:textField class="currency" name="regFee" value="${fieldValue(bean: semesterInstance, field: 'regFee')}" />
                        </td>
                    </tr>

                    <tr class="prop">
                        <td valign="top" class="name">
                            <label for="lateRegFee"><g:message code="semester.lateRegFee.label" default="Late Reg. Fee" /></label>
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: semesterInstance, field: 'lateRegFee', 'errors')}">
                            <g:textField class="currency" name="lateRegFee" value="${fieldValue(bean: semesterInstance, field: 'lateRegFee')}" />
                        </td>
                        <td style="width:20px"></td>
                        <td valign="top" class="name">
                            <label for="changeClassFee"><g:message code="semester.changeClassFee.label" default="Change Class Fee" /></label>
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: semesterInstance, field: 'changeClassFee', 'errors')}">
                            <g:textField class="currency" name="changeClassFee" value="${fieldValue(bean: semesterInstance, field: 'changeClassFee')}" />
                        </td>
                    </tr>

                    <tr class="prop">
                        <td valign="top" class="name">
                            <label for="returnBookFee"><g:message code="semester.returnBookFee.label" default="Return Book Fee" /></label>
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: semesterInstance, field: 'returnBookFee', 'errors')}">
                            <g:textField class="currency" name="returnBookFee" value="${fieldValue(bean: semesterInstance, field: 'returnBookFee')}" />
                        </td>
                        <td style="width:20px"></td>
                        <td valign="top" class="name">
                            <label for="earlyRegDiscount"><g:message code="semester.earlyRegDiscount.label" default="Early Reg. Discount" />&nbsp;(%)</label>
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: semesterInstance, field: 'earlyRegDiscount', 'errors')}">
                            <g:textField class="numeric" maxlength="2" name="earlyRegDiscount" value="${fieldValue(bean: semesterInstance, field: 'earlyRegDiscount')}" />
                        </td>
                    </tr>

                    <tr class="prop">
                        <td valign="top" class="name">
                            <label for="podFee"><g:message code="semester.returnBookFee.label" default="Parent On Duty Fee" /></label>
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: semesterInstance, field: 'podFee', 'errors')}">
                            <g:textField class="currency" name="podFee" value="${fieldValue(bean: semesterInstance, field: 'podFee')}" />
                        </td>
                        <td></td>
                        <td valign="top" class="name">
                            <label for="active"><g:message code="semester.active.label" default="Active" /></label>
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: semesterInstance, field: 'active', 'errors')}">
                            <g:select name="active" from="['N', 'Y']" value="N" />
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div class="buttons">
            <span class="button"><g:submitButton name="create" class="save" value="${message(code: 'default.button.create.label', default: 'Create')}" /></span>
            <span class="button"><input type="reset" value="${message(code: 'default.button.clear.label', default: 'Reset')}" /></span>
        </div>
    </g:formRemote>
</div>